<?php
namespace App\Admin\Controllers;

use App\Admin\Models\Setting;
use Illuminate\Http\Request;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Show;
use Illuminate\Support\Facades\Storage;
use function foo\func;
class SettingController extends AdminController
{
    protected $title = '推广背景图';

    protected function grid()
    {
        $grid = new Grid(new Setting);
        $grid->disableExport();
        $grid->disableCreateButton();
        $grid->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableView();
            $actions->disableDelete();
        });
        $grid->disableFilter();
        $grid->column('key','配置项');
        $grid->column('value','配置图片')->lightbox(['width' => 40, 'height' => 40]);
        $grid->column('note','配置说明');
        return $grid;
    }

    protected function form()
    {
        $form = new Form(new Setting);
        $form->tools(function (Form\Tools $tools) {
            $tools->disableDelete();
            $tools->disableView();
        });
        $form->text('key','配置说明')->disable();
        $form->image('value','配置图片');
        $form->textarea('note','配置说明');
        return $form;
    }
}
